#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -e $0)")
# shellcheck source=image
. ${SCRIPT_DIR}/image

# if [ -z "$BASENAME" ]; then
#   docker build -t dev.k2data.com.cn:5001/k2data/pas-ui:dev-0.4.0 .
#   docker push dev.k2data.com.cn:5001/k2data/pas-ui:dev-0.4.0
# else
#   docker build -t dev.k2data.com.cn:5001/k2data/pas-ui:dev-0.4.0-kmx .
#   docker push dev.k2data.com.cn:5001/k2data/pas-ui:dev-0.4.0-kmx
# fi

set -x
docker build -t ${IMAGE} \
  --build-arg branch=${GIT_BRANCH} \
  --build-arg commit="$(git rev-parse HEAD)" \
  --build-arg buildtime="$(date +"%Y-%m-%d %T")"  \
  --build-arg owner=${IMAGE_OWNER} ${SCRIPT_DIR}

docker login dev.k2data.com.cn:5001 -p registrypassw0rd -u registryuser
docker push ${IMAGE}
